<?php
	include 'conn.php';
	$result = mysqli_query($con,"SELECT * FROM contents");
	session_start();
	if(isset($_SESSION['user_name'])){ 
	echo "<table border='1'>
	<tr>
	<th>时间</th>
	<th>名字</th>
	<th colspan=3>操作</th>
	</tr>";} else 
	{
	echo "<table border='1'>
	<tr>
	<th>时间</th>
	<th>名字</th>
	<th colspan=3></th>
	</tr>";}
	while($row = mysqli_fetch_array($result))
	 {
	echo "<tr>";
	echo "<td>" . $row['time'] . "</td>";
	echo "<td><a href=get_content.php?id=" . $row['ID']." > ". $row['author']."</a></td>";
	echo "<td><a href=get_content.php?id=" . $row['ID']." >详情</a></td>";
	if(isset($_SESSION['user_name'])){ 
	echo "<td><a href=up_content.php?id=" . $row['ID']." >修改</a></td>";
	echo "<td><a href=del_content.php?id=" . $row['ID']." >删除</a></td>";
	}
	echo "</tr>";
	 }
	echo "</table>";
	mysqli_close($con);
	?>
